// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "SaveGameWidget.generated.h"

UCLASS()
class MISCELLANEOUSPROJECT_API USaveGameWidget : public UUserWidget
{
	GENERATED_BODY()
public:
	virtual void NativeOnInitialized() override;
	virtual void NativeDestruct() override;
	
	void ShowSaveWidget(float DisplayTime = 5.f, FText InSaveText = FText::FromString(FString("Saving...")), FLinearColor TextColor = FLinearColor(1.f, 0.4784f, 0.f, 1.f), FLinearColor LargeBarColor = FLinearColor(1.f, 0.4784f, 0.f, 1.f), FLinearColor MediumBarColor = FLinearColor(1.f, 0.4784f, 0.f, 1.f), FLinearColor SmalBarColor = FLinearColor(1.f, 0.4784f, 0.f, 1.f));
	void BarProgress();
	void ResetBars();
	UFUNCTION(BlueprintCallable, Category = MissionComponent)
	void ShowWidget() {ShowSaveWidget();}
private:
	void DelayLater(float DisplayTime);
	void DelayCall();
public:
	UPROPERTY(meta = (BindWidget))
	class UBorder* Bar;
	UPROPERTY(meta = (BindWidget))
	class UBorder* Bar2;
	UPROPERTY(meta = (BindWidget))
	class UBorder* Bar3;
	UPROPERTY(meta = (BindWidget))
	class UTextBlock* SavingText;

private:
	float Bar1Progress;
	float Bar2Progress;
	float Bar3Progress;
	float IncreaseValue;
	FTimerHandle TimerBarHandle;
	FTimerHandle DelayHandle;
};
